using SkaldRogueLike.Main.CellContent.Creatures;
using SkaldRogueLike.Main.Common;
using SkaldRogueLike.Main.Constants;
using SkaldRogueLike.Main.Constants.Enumerations;

namespace SkaldRogueLike.Main.CellContent.ContentFactories
{
    public class MonsterFactory : IGameFactory
    {
        private const int MonsterCount = 5;

        public int CurrentNumber { get; private set; }
        public int Uniquiness { get; set; }

        public MonsterFactory(int uniquiness)
        {
            Uniquiness = uniquiness;
            CurrentNumber = StaticRandom.Next(MonsterCount);
        }

        public Main.CellContent.CellContent Create()
        {
            CurrentNumber = Uniquiness > StaticRandom.Next(100)
                ? StaticRandom.NextNotEqualToOld(0, MonsterCount, CurrentNumber)
                : CurrentNumber;
            return GenerateMonster(CurrentNumber);
        }

        private static Monster GenerateMonster(int i)
        {
            switch (i)
            {
                case 0:
                    return new Monster("Goblin", 10, 5, 5, "g", Colors.Green, "Evil. Green.");
                case 1:
                    return new Monster("Red Dragon", 1000, 500, 500, "D", Colors.Red, "Beautiful creature.") 
                                {Condition = Condition.Peacefull};
                case 2:
                    return new Monster("Blue Dragon", 1000, 500, 500, "D", Colors.Blue, "Beautiful creature.") 
                        { Condition = Condition.Peacefull };
                case 3:
                    return new Monster("Black Dragon", 1000, 500, 500, "D", Colors.Black, "Beautiful creature.") 
                        { Condition = Condition.Peacefull };
                case 4:
                    return new Monster("Gold Dragon", 1000, 500, 500, "D", Colors.Yellow, "Beautiful creature.") 
                        { Condition = Condition.Peacefull };
                default:
                    return new Monster("Invisible", 0, 0, 0, ".", Colors.White);
            }
        }
    }
}